package com.eostoken.eos_wallet.mvp.presenter;


import android.app.Activity;
import android.content.Context;

import com.eostoken.eos_wallet.mvp.callback.CommonCallback;
import com.eostoken.eos_wallet.mvp.mode.BillModel;
import com.eostoken.eos_wallet.mvp.mode.HomeModel;
import com.eostoken.eos_wallet.mvp.view.BillView;
import com.eostoken.eos_wallet.mvp.view.HomeView;
import com.fredy.mvp.BasePresenter;

import java.util.Map;

import static com.eostoken.eos_wallet.utils.Constants.ACCOUNTS;
import static com.eostoken.eos_wallet.utils.Constants.ACCOUNT_INFO;
import static com.eostoken.eos_wallet.utils.Constants.BALANCE;
import static com.eostoken.eos_wallet.utils.Constants.BILL;
import static com.eostoken.eos_wallet.utils.Constants.PRICE;
import static com.eostoken.eos_wallet.utils.Constants.TRANSACTION;

public class BillPresenterImpl extends BasePresenter<BillModel, BillView> implements BillPresenter, CommonCallback {
    private Activity context;

    public BillPresenterImpl(Activity context) {
        super(context);
        this.context = context;
    }

    @Override
    public void onSuccess(Object data, String successMsg, int responseSuccessCode) {
        switch (responseSuccessCode) {
            case BILL:
            case TRANSACTION:
                if (getView() != null)
                    getView().updateView(data, responseSuccessCode);
                break;
        }
    }

    @Override
    public void onFailure(String msg, int responseFailCode) {
        switch (responseFailCode) {
            case BILL:
            case TRANSACTION:
                if (getView() != null)
                    getView().onFailure(msg, responseFailCode);
                break;
        }
    }

    @Override
    protected void onViewDestroy() {

    }

    @Override
    public void getData(boolean isRefresh) {

    }

    @Override
    public void getMoreData() {

    }

    @Override
    public void requestKeyActions(Map<String, Object> params) {
        model.getActions(context, params, true, this);
    }

    @Override
    public void requestTransaction(Map<String, Object> params) {
        model.getTransaction(context, params, true, this);
    }
}
